﻿@model UsersJoinList
@{
    ViewBag.Title = "List Accounts";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>
    List Accounts
</h2>
<div class="grid-main">    
    @(Html.Telerik().Grid(Model)
          .Name("Grid")
          .DataKeys(keys => keys.Add(p => p.ID))        
          .Columns(columns =>
            {
                columns.Bound(o => o.No).Width(50);
                //columns.Bound(o => o.ID).Width(200);
    @*columns.Template(
    @<text>
    <img 
            alt="" 
            src="@Url.Content("~/Upload/" + item.CountryFlagPath) "
            width="20"
            height="14" 
            />
    </text>
    ).Width(40);*@
                columns.Bound(o => o.LoginName).Width(100);
                columns.Bound(o => o.FullName).Width(150);
                //columns.Bound(o => o.Telephone).Width(100);
                //columns.Bound(o => o.CreateAt).Format("{0:dd/MM/yyyy}").Width(100);
                columns.Bound(o => o.IsEnable).ClientTemplate("<# if (IsEnable) { #> <img alt='<#= IsEnable #>' src='" + Url.Content("~/Content/img/lock_off.png") + "'/>" + "<# } else { #> <img alt='<#= IsEnable #>' src='" + Url.Content("~/Content/img/lock.png") + "' /> <# } #>").Title("Status").Width(80).HtmlAttributes(new { style = "text-align: center" });
                columns.Command(commands =>
                                    {
                                        commands.Custom("viewDetail")
                                            .Text("Set CEO")
                                            .DataRouteValues(route => route.Add(o => o.ID).RouteKey("usersID"))
                                            .Ajax(false)
                                            .Action("SetPermission", "Users")
                                            .HtmlAttributes(new { style = "text-align: center" });
                                        commands.Custom("setActive")
                                            .Text("Set Active and Admin")
                                            .DataRouteValues(route => route.Add(o => o.ID).RouteKey("usersID"))
                                            .Ajax(false)
                                            .Action("SetActiveAndAdmin", "Users")
                                            .HtmlAttributes(new { style = "text-align: center" });
                                        commands.Delete();
                                    })
                    .Width(270).HtmlAttributes(new { style = "text-align: center" });

            })
          .DataBinding(dataBinding => dataBinding.Ajax().Select("AjaxIndex", "Users").Enabled(true)
                                                  .Delete("AjaxDelete", "Users"))
          .Selectable()
                  .Scrollable(scrolling => scrolling.Enabled(true))
                  .Sortable(sorting => sorting.Enabled(true))
                  .Pageable(paging => paging.PageSize(20).Enabled(true))
                  .Filterable(filtering => filtering.Enabled(true))
                  .Groupable(grouping => grouping.Enabled(true))
                  .Footer(true)
          .ClientEvents(events => events.OnComplete("Assessments_onComplete"))
          .Groupable(settings => settings.Groups(g => { g.Add(model => model.CountryName); g.Add(model => model.OfficeName); }))
          )

</div>
<script src="@Url.Content("~/Scripts/indo.common.js")" type="text/javascript"></script>